package thirdassigment;

import java.io.File;

public class MkDir implements ICommandExecutor{
	private static ICommandExecutor instance;
public void execute(String path){
	
	String[] StrArray = path.split(" ");
	String directory = StrArray[1];
	String Title="";
	File p = new File(directory);
	
	if(!p.exists()){
		System.out.println("Directory is not correct");
	}else Title=StrArray[1]+"/"+StrArray[2];
	
	if(!"".equals(Title)){
	File p1 =new File(Title);		
	if(p1.exists())
    {
        System.out.println("Directory was created");
    }else 
   	
	p1.mkdir();
	p1.mkdirs();
    
}}

private MkDir(){          
}
public static ICommandExecutor getInstance() {
    if(instance==null){
            instance=new MkDir();       
            }
    return instance;
}

}
